{extend name="admin@public/base" /}
{block name="main-content"}
<div class="page-content">

    <div class="row maintop">
        <div class="col-xs-5 col-sm-2  margintop5">
            <a href="{:url('admin/Module/add')}">
                <button class="btn btn-sm btn-danger">
                    <i class="ace-icon fa fa-bolt bigger-110"></i>
                    添加模块
                </button>
            </a>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div>
                <table class="table table-striped table-bordered table-hover" id="dynamic-table">
                    <thead>
                    <tr>
                        <th class="hidden-xs">ID</th>
                        <th>模块标识</th>
                        <th>模块标题</th>
                        <th>模块备注</th>
                        <th class="hidden-sm hidden-xs">模块URL</th>
                        <th>状态</th>
                        <th style="border-right:#CCC solid 1px;">操作</th>
                    </tr>
                    </thead>

                    <tbody>
                    {foreach name="module" item="v"}
                    <tr>
                        <td height="28" class="hidden-xs">{$v.id}</td>
                        <td>{$v.module_name}</td>
                        <td>{$v.module_title}</td>
                        <td>{$v.module_remark}</td>
                        <td class="hidden-sm hidden-xs">{$v.module_url}</td>
                        <td class="hidden-sm hidden-xs">{$v.module_status_name}</td>
                        <td>
                            <div class="hidden-sm hidden-xs action-buttons">
                                <a class="green" href="{:url('admin/Module/edit',['id'=>$v.id])}" title="修改">
                                    <i class="ace-icon fa fa-pencil bigger-130"></i>
                                </a>
                                <a class="red confirm-rst-url-btn"
                                   href="{:url('admin/Module/del',array('id'=>$v['id']))}" data-info="你确定要删除吗？不建议直接删除"
                                   data-toggle="tooltip" title="删除">
                                    <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                </a>
                            </div>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>

            </div>
            {$page}
        </div>
    </div>
</div><!-- /.page-content -->
{/block}
{block name="scripts"}
<script src="__PUBLIC__/bootstrap-select/js/bootstrap-select.min.js"></script>
<script>
    //保存模块
    $('.save-sel').click(function () {
        var $form=$('.modelform'),$url=$form.attr('action');
        $.post(
            $url,
            $form.serialize(),
            function (data) {
                if (data.code==1) {
                    layer.alert(data.msg, {icon: 6}, function (index) {
                        layer.close(index);
                        window.location.href = data.url;
                    });
                } else {
                    layer.alert(data.msg, {icon: 5});
                }
            }, "json");
        return false;
    });
</script>
{/block}
